<template>
	<view class="content-box">
		<navBack></navBack>
		<view class="state-list">
			<block v-for="(item, index) in typeList">
				<view class="line" v-if="index">

				</view>
				<view class="state-item">
					<image src="/static/me/dot.png"
						:style="'filter:'+(item.type>check?'grayscale(100%)':'grayscale(0)')" mode=""></image>
					<view class="">
						{{item.text}}
					</view>
				</view>
			</block>
		</view>
		<u-alert v-if="check==3" title="驳回理由" type="error" :description="user.refuseReason"></u-alert>

		<block v-if="check===0||check==3">
			<view class="title">
				当前等级
			</view>

			<view class="box">

				<view class="" style="text-align: center;display: flex;align-items: center;justify-content: center;">
					<image src="/static/me/line.png" style="width: 24rpx;" mode="widthFix"></image>
					<text style="padding: 0 14rpx;">{{user.driverLevelName||'暂无等级'}}</text>
					<image src="/static/me/line.png" style="width: 24rpx;" mode="widthFix"></image>
				</view>


				<image :src="$imageUrl(user.image)" mode=""></image>

				<view class="money">
					已支付保证金￥{{user.paidForPrice}}
				</view>
				<view class="hint">
					<view class="">
						提示：
					</view>
					<view class="">
						申请退回保证金后，自动变为初始等级<br />
						不能接取订单
					</view>
				</view>
			</view>

			<view class="btn" @click="backCashPledgeShow=true">
				退回保证金
			</view>
			<view class="btn_">
				联系客服
			</view>
		</block>

		<view class="success-box" v-else>

			<image src="/static/payment-success.png" mode="widthFix"></image>
			<view style="color: #FFC837;margin-top: -185rpx;font-size: 32rpx;font-weight: 700;">
				提交成功·审核中
			</view>
			<view style="color: #999999;margin-top: 20rpx;">
				管理员将在24小时内完成审核
			</view>
			<view style="font-size: 24rpx;color: #999999;margin-top: 360rpx;">
				如果有任何问题可以联系平台客服<br />
				或拨打客服电话{{driverCustomerServiceMobile}}
			</view>
			<view class="btn" style="margin: 30rpx auto;width: 338rpx;height: 80rpx;"
				@click="$routeTo('/pages/me/me',true)">
				确定
			</view>
		</view>



		<u-modal :show="backCashPledgeShow" @close="closeBackCashPledge" @cancel="closeBackCashPledge"
			@confirm="confirm" closeOnClickOverlay width="622rpx" showCancelButton cancelText="暂不退回"
			confirmColor="#FFCE4E">
			<view class="slot-content" style="text-align: center;">
				<view style="font-size: 32rpx;font-weight: bold;
							color: #FFCE4E;">
					当前车型：{{user.driverLevelName}}
				</view>
				<view style="font-size: 32rpx;color: #333333;font-weight: bold;padding: 36rpx 0 26rpx 0;">
					是否确认申请退回保证金？
				</view>
				<view style="font-size: 24rpx;color: #999999;display: flex;justify-content: center;">
					<view class="">
						提示：
					</view>
					<view class="">
						申请退回保证金后，自动变为初始等级<br />
						只能接一个爱心单以及一个拼单
					</view>
				</view>
			</view>
		</u-modal>


		<Loading />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				backCashPledgeShow: false,
				typeList: [{
					text: '申请退款',
					type: 1
				}, {
					text: '待审核',
					type: 1
				}, {
					text: '已审核',
					type: 2
				}, {
					text: '退款到账',
					type: 2
				}],
				user: {},
				check: 0,
				driverCustomerServiceMobile: uni.getStorageSync('phoneNumber')
			}
		},
		onLoad() {
			this.upData()

		},
		methods: {
			upData() {
				this.$myRequest('/api/driver/mine/v1/current/carInfo').then(res => {
					this.user = res.data
					this.check = res.data.check || 0
				})
			},
			closeBackCashPledge() {
				this.backCashPledgeShow = false
			},
			confirm() {
				this.closeBackCashPledge()
				this.$myRequest('/api/driver/mine/v1/return/margin', {}, 'POST').then(res => {
					uni.showToast({
						title: '申请已提交',
						icon: 'none'
					})
					this.upData()
				})

			}
		}
	}
</script>

<style lang="scss">
	.state-list {
		display: flex;
		justify-content: space-between;
		padding: 198rpx 40rpx 0 40rpx;

		.state-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			font-size: 28rpx;
			color: #333333;

			image {
				width: 46rpx;
				height: 46rpx;
				margin-bottom: 16rpx;
			}
		}

		.line {
			width: 46rpx;
			height: 10rpx;
			border-radius: 6rpx;
			background-color: #E2E2E2;
			margin-top: 18rpx;
		}
	}

	.title {
		font-size: 28rpx;
		color: #333333;
		font-weight: bold;
		padding-left: 40rpx;
		margin-top: 100rpx;
	}

	.box {
		display: flex;
		flex-direction: column;
		align-items: center;

		image {
			width: 262rpx;
			height: 126rpx;
			border-radius: 14rpx;
		}

		.money {
			font-size: 28rpx;
			color: $theme-color;
			font-weight: bold;
			margin: 20rpx 0;
		}

		.hint {
			font-size: 24rpx;
			color: #999999;
			text-align: center;
			display: flex;
		}


	}

	.success-box {
		font-size: 28rpx;
		text-align: center;
		padding-top: 100rpx;

		image {
			width: 564rpx;
			margin: 0 auto;
			display: block;
		}


	}

	.btn {
		width: 638rpx;
		height: 88rpx;
		background: $theme-color;
		border-radius: 44rpx;
		text-align: center;
		font-size: 28rpx;
		line-height: 88rpx;
		color: #FFFFFF;
		margin: 380rpx auto 20rpx auto;

	}

	.btn_ {
		color: $theme-color;
		font-size: 28rpx;
		text-align: center;
	}
</style>